//
//  InstallationPointsTableViewController.m
//  GoodWayClient
//
//  Created by HuiDong on 15/12/3.
//  Copyright © 2015年 HuiDong. All rights reserved.
//

#import "InstallationPointsTableViewController.h"
#import "InstallationPointTableViewCell.h"
#import "ShowMore.h"

@interface InstallationPointsTableViewController ()

@property (nonatomic, strong) NSArray *array;
@property (nonatomic, strong) NSMutableArray *arrayAll;

@end

@implementation InstallationPointsTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //footView的加载更多的显示
    ShowMore *showMore = [ShowMore footView];
    
    __weak InstallationPointsTableViewController *tempController = self;
    
    ShowMoreBlock block = ^{
        [tempController.arrayAll addObjectsFromArray:tempController.array];
        [tempController.tableView reloadData];
    };
    
    showMore.block = block;
    self.tableView.tableFooterView = showMore;
    [self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

//数组懒加载
- (NSArray *)array
{
    if (!_array) {
        _array = @[@{@"installationPoint":@"玄武区珠江路安装点",@"phone":@"11111111",@"address":@"珠江路新世界B座3912室"},
                   @{@"installationPoint":@"玄武区珠江路安装点",@"phone":@"11111111",@"address":@"珠江路新世界B座3912室"},
                   @{@"installationPoint":@"玄武区珠江路安装点",@"phone":@"11111111",@"address":@"珠江路新世界B座3912室"},
                   @{@"installationPoint":@"玄武区珠江路安装点",@"phone":@"11111111",@"address":@"珠江路新世界B座3912室"}
                   ];
    }
    return _array;
}

- (NSMutableArray *)arrayAll
{
    if (!_arrayAll) {
        _arrayAll = [NSMutableArray arrayWithArray:self.array];
    }
    return _arrayAll;
}


//设置数据源方法-行数和行内内容
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.arrayAll.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    InstallationPointTableViewCell *cell = [InstallationPointTableViewCell InstallationPointsWithTableView:tableView];
    cell.dic = self.arrayAll[indexPath.row];
    return cell;
}



//设置行高
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 120;
}



//隐藏状态栏
-(UIStatusBarStyle)preferredStatusBarStyle
{
    return YES;
}


@end
